package com.wyp168.juc;

/**
 * @ClassName InterruptedDemo003
 * @Description TODO
 * @Author wyp168
 * @Date 2022/7/8 15:05
 */
public class InterruptedDemo003 {
    public static void main(String[] args) throws InterruptedException {
        Thread threadA = new Thread(() -> {
//            while(!Thread.currentThread().isInterrupted()){}
//            System.out.println(Thread.currentThread() + " ---> " + Thread.currentThread().interrupted());

            for (;;);

        });

        threadA.start();
        System.out.println(threadA.isInterrupted());
        Thread.sleep(1000);

        threadA.interrupt();
        Thread.sleep(2000);
        System.out.println("Main Thread check threadA isInterrupter: " + threadA.isInterrupted());


        threadA.join();

        System.out.println("Main is over!");
    }
}
